<template lang="pug">
    skin(@up="up",@down="down",@yes="yes",@back="back",@duringUp="up",@duringDown="down")
        div(class="flex-column exhaust-history h3")
            div(class="flex-column-item flex-center-center") 
                span ----大剂量回顾----
            div(class="flex-column-item flex-row" v-for="item in currentPageMenus")
                div(class="flex-row-item") 
                  span {{item.date | format('MMDD')}}
                div(class="flex-row-item right") 
                  span {{item.date | format('HH:mm')}}>
                  span {{item.amount}}
                div(class="flex-row-item right") 
                  span u

            div(:class="'flex-'+(3-currentPageMenus.length)")
    
</template>

<script>
import Base from '@/mixins/BaseVue'
export default {
  mixins:[Base],
  data() {
    return {
      items: [],
      page: { pageIndex: 1, pageSize: 3 }
    };
  },
  computed: {
    currentPageMenus() {
      const start = (this.page.pageIndex - 1) * this.page.pageSize;
      const end = start + this.page.pageSize;
      return this.items.slice(start, end);
    },
    totalPage() {
      const zs = Math.round(this.items.length / this.page.pageSize);
      return this.items.length % this.page.pageSize == 0 ? zs : zs + 1;
    }
  },

  methods: {
    up() {
      this.page.pageIndex =
        this.page.pageIndex == 1 ? this.totalPage : this.page.pageIndex - 1;
    },
    down() {
      this.page.pageIndex =
        this.page.pageIndex == this.totalPage ? 1 : this.page.pageIndex + 1;
    },

    back() {
      this.$router.push("/large-dose?index=3");
    },
    yes() {}
  },
  created() {
      let records = [].concat(window.dose.records).reverse();
      this.items = records;
  }
};
</script>

<style lang="less">
</style>
